Skip to content

fix(input): allow escape as a prefix-mode keybinding - #2322

Open
fraidev wants to merge 4 commits into
herdrdev:masterfrom
fraidev:fix/prefix-escape-keybind
Open

fix(input): allow escape as a prefix-mode keybinding#2322
fraidev wants to merge 4 commits into
herdrdev:masterfrom
fraidev:fix/prefix-escape-keybind

Conversation

@fraidev

@fraidev fraidev commented Aug 4, 2026

Copy link
Copy Markdown

Hey!

Esc always canceled prefix mode before keybinds ran, so copy_mode = "prefix+esc" (like tmux bind Escape copy-mode) never worked even though the config accepted it.

This treats Esc as a normal prefix RHS when bound; unbound Esc still cancels prefix mode.

Happy to adjust anything if needed.

Prefix mode always canceled on Esc before binding lookup, so configs like
copy_mode = "prefix+esc" (tmux bind Escape copy-mode) never ran. Unbound
Esc still cancels prefix mode via the unmatched-key path.
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 38eea941-a01a-4b42-970b-5080fe47506f

📥 Commits

Reviewing files that changed from the base of the PR and between 199e2eb and 5109336.

📒 Files selected for processing (2)
  • docs/next/CHANGELOG.md
  • src/app/input/navigate.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/next/CHANGELOG.md
  • src/app/input/navigate.rs

📝 Walkthrough

Walkthrough

Escape now supports configured prefix-mode bindings through esc or escape. Unbound Escape still exits prefix mode. Tests cover parsing, dispatch, fallback behavior, and copy-mode entry. Documentation describes the updated behavior in English, Japanese, and Chinese.

Changes

Escape prefix bindings

Layer / File(s) Summary
Escape key alias parsing
src/config/keybinds.rs
Tests verify case-insensitive esc and escape aliases for prefix bindings.
Prefix dispatch and fallback
src/app/input/navigate.rs
Prefix handling dispatches configured Escape bindings before using unbound Escape to exit prefix mode. Tests cover copy-mode entry and cancellation.
Documented Escape behavior
docs/next/CHANGELOG.md, docs/next/website/src/content/docs/*/configuration.mdx
The changelog and configuration guides document Escape aliases, prefix bindings, and fallback behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant PrefixMode
  participant KeybindingResolver
  participant CopyMode
  User->>PrefixMode: Press prefix then Escape
  PrefixMode->>KeybindingResolver: Resolve configured Escape binding
  KeybindingResolver->>CopyMode: Execute copy-mode action
  PrefixMode-->>User: Exit prefix mode when Escape is unbound
Loading

Possibly related PRs

  • herdrdev/herdr#2243: Both PRs modify prefix/action dispatch behavior in src/app/input/navigate.rs.
  • herdrdev/herdr#2340: Both PRs modify cancellation handling and tests in src/app/input/navigate.rs.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: allowing Escape as a prefix-mode keybinding.
Description check ✅ Passed The description accurately explains the Escape binding change and its fallback behavior when Escape is unbound.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@kangal-bot kangal-bot added the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 4, 2026
@greptile-apps

greptile-apps Bot commented Aug 4, 2026

Copy link
Copy Markdown

Greptile Summary

This PR allows Escape to participate in normal prefix-mode keybinding dispatch while preserving cancellation for unbound Escape.

  • Removes the unconditional early Escape cancellation from prefix-key handling.
  • Adds coverage for bound and unbound Escape behavior and the esc/escape aliases.
  • Updates the changelog and localized configuration documentation.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/app/input/navigate.rs Reorders prefix-mode Escape handling so configured actions run before the existing fallback that leaves prefix mode, with tests for bound and unbound behavior.
src/config/keybinds.rs Adds configuration tests confirming that case variants of both esc and escape resolve to an Escape prefix trigger.
docs/next/website/src/content/docs/configuration.mdx Documents Escape aliases and the distinction between bound prefix actions and unbound cancellation.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Escape pressed in prefix mode] --> B{Prefix binding matches Escape?}
  B -->|Yes| C[Execute configured action]
  B -->|No| D[Leave prefix mode]
Loading

Reviews (3): Last reviewed commit: "Merge branch 'master' into fix/prefix-es..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Trigger automated AI reviews for pull requests admitted by the PR gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants